<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="/fuman/js/purchase.js" ></script>
<script language="javascript" src="/fuman/js/TableFreeze.js"></script>
<script language="javascript">
  function onstsubmit()
	{
		$('#expressform').modal('hide');	
		$('#attributeform').submit();
	}
  function getsupplier()
  {
	 var supplier = $("#supplier").val();
	 if(supplier ==1 || supplier==2)
	 {
		$("#isarea").show();
	  }else{
		$("#isarea").hide();  
	}	
	 
  }
$(function() {
	$("#table2").freezeHeader();
})
</script>
<title>库存预警</title>
<body class="withvernav">
<div class="bodywrapper">
{{include file='/public/orderleft.tpl'}}
<div class="centercontent">
  <div class="pageheader notab">
    <h1 class="pagetitle">库存预警</h1>
    <span class="pagedesc">
    1、停产  清仓  暂停销售 状态下的SKU不显示<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2、采购数=日均销量	*采购天数	- 当前库存<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3、7/30/60销量包含直发和FBA的销量<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4、库存警戒天数：商品本身设置的天数比搜索条件中的库存警戒天数大，以商品设置的为准
    <br>
    <font color="#FF0000"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5、开发人员临时仓位：{{$arr_positions}}</font>
    </span>
    
  </div>
  <!--pageheader-->
  <div id="contentwrapper" class="contentwrapper">
    <div id="basicform" class="subcontent"> 
      <!--搜索栏-->
      <div> </div>
      <div style="clear: both"></div>
    </div>
    <form class="stdform stdform2" method="get" id="search" action="/purchase/automaticProducePurchase">
      <div class="tableoptions">
       
      
  
        <select name="filtertype">
          <option value="">-查询条件-</option>
          <option value="productname" {{if $filtertype=='productname'}} selected{{/if}}>商品名称</option>
          <option value="productid" {{if $filtertype=='productid'}} selected{{/if}}>商品编号</option>
          <option value="positions"  {{if $filtertype=='positions'}} selected{{/if}}>库位</option>
        </select>
        :
        <input type="text" name="kw" id="kw" class="width200" value="{{$kw}}" placeholder="关键词" />
       <select name="supplier" id="supplier" class="selection" onChange="getsupplier()" >
                    <option value="">供货商</option>
                    {{foreach from=$factory item=res key=key}}
                    <option value="{{$res.id}}" {{if $res.id == $supplier}} selected{{/if}}>{{$res.name}}</option>
                    {{/foreach}}
                  </select>  
        &nbsp;
                <select name="isarea" id="isarea" class="selection" {{if $isarea}}{{else}}style="display:none"{{/if}}>
                <option value="">版型</option>
                <option value="1" {{if 1== $isarea}} selected{{/if}}>欧美</option>
                <option value="2" {{if 2== $isarea}} selected{{/if}}>亚洲</option>
                <option value="3" {{if 3== $isarea}} selected{{/if}}>通用</option>
                </select>  
                
        <select class="selectCss2" name="cate" id="cate">
                    <option value="">商品类别</option>
                    {{foreach from=$proudctcate item=res key=key}}
                    <option value="{{$key}}" {{if $cate == $key}} selected{{/if}}> {{$res}} </option>
                    {{/foreach}}
                  </select>
         <select class="selectCss2" name="sl" id="sl">
                    <option value="3" {{if 3== $sl}} selected{{/if}}>日均类别</option>
                 <option value="1" {{if 1== $sl}} selected{{/if}}>1号仓</option>
                <option value="2" {{if 2== $sl}} selected{{/if}}>直发+FBA</option>
        </select>
        采购天数：<input type="text" name="g_procurement" id="g_procurement" class="width50" value="{{$g_procurement}}" placeholder="采购天数" />
        库存警戒天数：	<input type="text" name="alertnum" id="alertnum" class="width50" value="{{$alertnum}}" placeholder="库存警戒天数" />
        
         			<select class="selectCss2" name="orderby" id="orderby">
                    <option value="">排序</option>
                    <option value="ASC" {{if $orderbysku == 'ASC'}} selected{{/if}}> 日均升序 </option>
                    <option value="DESC" {{if $orderbysku == 'DESC'}} selected{{/if}}> 日均降序 </option>
                    <option value="SDESC" {{if $orderbysku == 'SDESC'}} selected{{/if}}> SKU排序 </option>
                  </select>
               采购人员:
        <select name="buyer" id="buyer" class="selection select2_group" style="width:100px;" >
            <option value="0">请选择</option>
            {{foreach from=$userlist item=res key=key}}
            <option value="{{$res}}" {{if $buyer eq $res}} selected{{/if}}>{{$res}}</option>
            {{/foreach}}
        </select>
        <button class="btn btn-primary" id="searchbtn">Search</button>
        <span style="float:right">
       <a href="javascript:void(0)" onClick="purchaseData()" class="stdbtn btn_red" target="_blank"><span>生成采购单</span></a>
       </span>
      </div>
    </form>
    <!--搜索栏结束-->
    <table cellpadding="0" cellspacing="0" id="table2" border="0" class="stdtable" style="table-layout: fixed;">
      <thead>
        <tr>
          <td width="2%"  bgcolor="#FEFFF1"><a onClick="allSelect('ppid[]')">全选</a></td>
          <td width="10%" bgcolor="#FEFFF1">商品编号</td>
          <td  width="20%" bgcolor="#FEFFF1">商品名称</td>
           <td  bgcolor="#FEFFF1" >采购数</td>
           <td  bgcolor="#FEFFF1">直发采购</td>
           <td  bgcolor="#FEFFF1">海外调拨</td>
           
          <td  bgcolor="#FEFFF1">成本价</td>
          <td  bgcolor="#FEFFF1">采购天数/警戒数</td>
          
           <td  bgcolor="#FEFFF1">库位</td>
          <td  bgcolor="#FEFFF1">7/30/60销量</td>
         
          <td  bgcolor="#FEFFF1" >日均销量</td>
          <td  bgcolor="#FEFFF1" >待发货数</td>
           <td  bgcolor="#FEFFF1">当前库存</td>
           <td  bgcolor="#FEFFF1" >在途</td>
         
          <td  bgcolor="#FEFFF1" >操作</td>
        </tr>
      </thead>
      <tbody >
      
      {{foreach from=$goodslist item=li key=key}}
      <tr>
        <td ><input name="ppid[]" type="checkbox" class="none" id="ppid[]" value="{{$li.goods_id}}" /></td>
        <td valign="middle" ><a href="/product/productlist?other={{$li.goods_sku}}" target="_blank"><font color="#6666FF">{{$li.goods_sku}}</font></a></td>
        <td valign="middle">
        {{if $li.g_sale_status==5}}<font color="red"><B>【清仓】</B></font>{{/if}}
      {{if $li.g_sale_status==4}}<font color="Blue"><B>【停产】</B></font>{{/if}}{{$li.goods_name}} {{if $li.memo}}
    	<a href="javascript:void(0)"><img src="/fuman/images/icons/question.png"><span id="tip_info">
                {{$li.memo}}</span></a>
    {{/if}}</td>
      
        <td valign="middle">
        
        
          
          <input type="text" name="nst[]" id="nst{{$li.goods_id}}" class="width200"  value="{{$li.neednst}}" style="    padding: 8px 5px; border: 1px solid #ccc;width: 85%;   -moz-border-radius: 2px;
    -webkit-border-radius: 2px;
    border-radius: 2px;
    background: #fcfcfc;
    vertical-align: middle;
    -moz-box-shadow: inset 0 1px 3px #ddd;
    -webkit-box-shadow: inset 0 1px 3px #ddd;
    box-shadow: inset 0 1px 3px #ddd;
    color: #666;">
   
          
           </td>
        <td valign="middle">{{$li.nst}}</td>
        <td valign="middle">{{$li.needskunum}}</td>
        <td valign="middle">{{$li.g_costprice}}</td>
        <td>{{$li.g_procurement}} / {{$li.alertnum}} </td>
        
          <td class="cz">{{$li.positions}}</td>
           <td class="cz">{{$li.sales1}}/{{$li.sales2}}/{{$li.sales3}}</td>
        <td valign="middle">{{$li.dailysales}}
          </td>
           <td valign="middle">{{$li.sendgoodsnum}}
          </td>
          <td class="cz">{{$li.stock}}</td>
          <td class="cz">{{$li.in_transit}}
          {{if $li.in_transit>0}}
              {{if $li.waitday}}
                <br>{{$li.waitday}}
              {{/if}}
          {{/if}}
          </td>
           
         
       
        <td class="cz">
         
          <span>
          <a href="/order/ajaxbutton?op=showhistoryOrder&goods_id={{$li.goods_id}}" target="_blank"> 查看订单</a>
          </span>          
        
        </td>
      </tr>
      {{/foreach}}
        </tbody>
      
    </table>
    <div class="page"></div>
  </div>
</div>
<form class="stdform stdform2" method="post" id="addpurchase" action="/purchase/addpurchase" target="_blank">
	<input type="hidden" value="" id="goods_id_list" name="goods_id_list">
    <input type="hidden" value="" id="goods_nums_list" name="goods_nums_list">
</form>

<div id="goToTop" style="display:none"><a href="javascript:;">TOP</a></div>
</body>
</html>